import sys
import os
sys.path.append(os.path.join(os.path.dirname(__file__), '../'))
import pandas as pd
import seaborn as sns
import matplotlib
import matplotlib.pyplot as plt
matplotlib.rc("font",family='FangSong')
from  utils import column_letter_to_index
# 读取数据
data_path = '../../data/raw_data/334份 按选项序号 汇总变量后.xlsx'
df = pd.read_excel(data_path)  
y_index_list = [column_letter_to_index(each) for each in ['AT','CG','CH','CI']]
df_y = df[df.columns[y_index_list]]
# 去掉第一行
df = df.drop(df.columns[0], axis=1)
# 计算协方差矩阵
corr_matrix = df_y.corr()

# 可视化协方差矩阵
sns.heatmap(corr_matrix, annot=True, cmap='coolwarm', square=True)
plt.title('Correlation Matrix')
plt.show()